package jrain.iot.server.mqtt.business;

import jrain.fw.core.business.Business;
import jrain.fw.core.business.BusinessMethod;
import jrain.fw.core.business.BusinessRequest;
import jrain.fw.core.business.BusinessResponse;
import jrain.fw.core.log.Logger;
import jrain.fw.core.log.LoggerFactory;
import jrain.iot.server.mqtt.consts.MqttConst;
import jrain.utils.lang.StringUtils;

@Business(name = "MqttSimpleEventService")
public class MqttSimpleEventService {

	private Logger logger = LoggerFactory.getLogger(MqttSimpleEventService.class);

	@BusinessMethod()
	public BusinessResponse handler(BusinessRequest request) {
		BusinessResponse response = new BusinessResponse();
		String userName = StringUtils.trimNull(request.getData(MqttConst.USER_NAME));
		String eventType = StringUtils.trimNull(request.getData(MqttConst.EVENT_TYPE));
		logger.info(request, "event:userName={},eventType={}", userName, eventType);
		return response;
	}
}
